/**
  ******************************************************************************
  * @file    nuc it.c
  * @brief   Interrupt Service Routines.
  ******************************************************************************
**/
#define _HAL_INIT_MODULE_
#include "common.h"
#include "hal_init.h"
#include "etimer.h"
#include "nucclk.h"
#include "uart.h"
#include "gpio.h"
#include "hal_mixed.h"
#include "sys_init.h"

OBJ_USED static uu8 mem_nocache_keep[10] OBJ_SECTION(".nocache_mem_site");

/*****************************************************************************/ /*!
*
* @brief   timer 0 run.
*
* @param   none
*
* @return  none
*
* @ Pass/ Fail criteria: none
*****************************************************************************/
void timer0_start(void)
{
    outpw(REG_TMR0_TCSR, (1UL << 26)); //reset timer0
    NOP10();
    while(inpw(REG_TMR0_TCSR) & (1UL << 26)) NOP1();
    outpw(REG_TMR0_TICR, 0xFFFFFF);
    outpw(REG_TMR0_TCSR, (1UL << 30) | 74); //start
}

uint32_t timer0_cnt_get(void)
{
    return inpw(REG_TMR0_TDR) / 1000;
}

void sysPutString(const char *string);
void rt_hw_console_output(const char *str)
{
    sysPutString(str);
}
